﻿// -----------------------------------------------------------------------
// <copyright file="Electric.cs" company="">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace Ex03.GarageLogic
{
    using System;
    using System.Collections.Generic;
    using System.Text;

    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    public class Electric : EnergySource
    {
        public Electric()
        {
            this.m_EnergyType = eEnergySourceType.Electricity;
        }

        /// <summary>
        /// This function Recharges the vehicles battery
        /// </summary>
        /// <param name="i_AmountToCharge">represents the amount of hours to chrage </param>
        /// <param name="i_FuelType">default value is Electric </param>
        public override void RechargeEnergySource(float i_AmountToCharge, eEnergySourceType i_FuelType)
        {
            if (this.m_CurrentEnergyQuantity + i_AmountToCharge <= this.m_MaxEnergyCapacity)
            {
                this.m_CurrentEnergyQuantity += i_AmountToCharge;
            }
            else
            {
                throw new ValueOutOfRangeException(0, m_MaxEnergyCapacity);
            }
        }

        public override StringBuilder GetEnergySourceDataPrint()
        {
            StringBuilder EnergyData = new StringBuilder();

            EnergyData.Append("This vehicle is: " + this.m_EnergyType.ToString() + System.Environment.NewLine);
            EnergyData.Append("The maximum battery time is: " + this.m_MaxEnergyCapacity + " hours" + System.Environment.NewLine);
            EnergyData.Append("The current Battery time is: " + this.m_CurrentEnergyQuantity + " hours" + System.Environment.NewLine);
            
            return EnergyData;
        }
    }
}
